package edu.maping.easy.sequence;

import java.util.HashMap;
import java.util.Iterator;

import processing.xml.XMLElement;

import controlP5.ControlEvent;
import edu.maping.easy.gui.GUIEvent;
import edu.maping.easy.gui.Slider;

public class ActionConf extends HashMap<String, Float> {

	/**
	 * 
	 */

	private static final long serialVersionUID = -5970514987067159522L;

	public boolean turnOn = false;

	public void controlEvent(GUIEvent event) {

		// if (event.isController()) {
		String name = event.name();
		if (containsKey(name)) {

			if (event.controller() instanceof Slider) {
				Slider slider = (Slider) event.controller();
				put(name, slider.getValue());
			}
		}
		// }

	}

	public ActionConf copy() {
		ActionConf actionConf = new ActionConf();
		Iterator<String> keys = keySet().iterator();
		while (keys.hasNext()) {
			String key = keys.next();

			actionConf.put(key, new Float(get(key)));
		}
		return actionConf;
	}
}
